<?php

use yii\grid\GridView;
use common\helpers\Html;
use common\helpers\ImageHelper;
use kartik\daterange\DateRangePicker;
use yii\widgets\ActiveForm;
use yii\helpers\Url;

$this->title = '周报详情';
$this->params['breadcrumbs'][] = $this->title;

/* @var $this \yii\web\View */
/* @var $dataProvider \yii\data\ActiveDataProvider */
/* @var $searchModel \common\models\base\SearchModel */

?>
<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <?php $form = ActiveForm::begin([
                    'action' => Url::to(['index']),
                    'method' => 'post',
                ]); ?>
                <div class="col-sm-3">
                    <div class="input-group drp-container">
                        <?= DateRangePicker::widget([
                            'name' => 'queryDate',
                            'value' => $start_time . '-' . $end_time,
                            'readonly' => 'readonly',
                            'useWithAddon' => true,
                            'convertFormat' => true,
                            'startAttribute' => 'start_time',
                            'endAttribute' => 'end_time',
                            'startInputOptions' => ['value' => $start_time],
                            'endInputOptions' => ['value' => $end_time],
                            'pluginOptions' => [
                                'locale' => ['format' => 'Y-m-d'],
                            ]
                        ]) ?>
                    </div>

                </div>
                <div class="col-sm-3">
                    <div class="input-group m-b">
                        <span class="input-group-btn"><button class="btn btn-white"><i class="fa fa-search"></i> 搜索</button></span>
                    </div>
                </div>
                <?php ActiveForm::end(); ?>
                <h3 class="box-title"><?= $this->title; ?></h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive">
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'filterModel' => $searchModel,//搜索框
                    //重新定义分页样式
                    'tableOptions' => ['class' => 'table table-hover'],
                    'columns' => [
                        [
                            'class' => 'yii\grid\SerialColumn',
                            'visible' => false, // 不显示#
                        ],
                        [
                            'attribute' => 'id',
                            'headerOptions' => ['class' => 'col-md-1'],
                        ],
                        'week',
                        'work',
                        'summary',
                        'help',
                        'creator_name',
                        [
                            'label' => '创建时间',
                            'attribute' => 'created_at',
                            'filter' => false, //不显示搜索框
                            'format' => ['date', 'php:Y-m-d'],
                        ],
                        'dept_name',
                        'remark',
                        'template_name',
                        [
                            'attribute' => 'images',
                            'value' => function ($model) {
                                return Html::img(ImageHelper::defaultHeaderPortrait(Html::encode($model->images)),
                                    [
                                        'class' => 'img-circle rf-img-md img-bordered-sm',
                                    ]);
                            },
                            'filter' => false,
                            'format' => 'raw',
                        ]
                    ],
                ]); ?>
                <!-- /.box-body -->
            </div>
            <!-- /.box -->
        </div>
    </div>
</div>